<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta name="description" content="">
        <meta name="author" content="">
        <title>Signin Template for Bootstrap</title>
        <!-- Bootstrap core CSS -->
        <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
        <!--        pom.xml中引入了bootstrap-->
        <!--        <link th:href="@{/webjars/bootstrap/4.0.4/css/bootstrap.css}">-->
        <!-- Custom styles for this template -->
        <link th:href="@{/css/signin.css}" rel="stylesheet">

        <script type="text/javascript" src="/js/jquery-3.2.1.min.js"></script>
        <script type="text/javascript">
            function toregister() {
                location.href = "register.html";
            }

        </script>
    </head>

    <body class="text-center">
        <form class="form-signin" th:action="@{/user/login}">
            <img class="mb-4" th:src="@{/img/bootstrap-solid.svg}" alt="" width="72" height="72">
            <h1 class="h3 mb-3 font-weight-normal" th:text="${info}!=null?${info}:#{login.tip}">Please sign in</h1>
            <label class="sr-only">Username</label>
            <input type="text" name="username" class="form-control is-valid" th:if="${session.name ne null}"
                   th:value="${session.name}" required=""
                   autofocus="">
            <input type="text" name="username" class="form-control is-valid" th:unless="${session.name ne null}"
                   th:placeholder="#{login.username}" required=""
                   autofocus="">
            <label class="sr-only">Password</label>
            <input type="password" name="password" class="form-control is-valid" th:if="${session.pwd ne null}"
                   th:value="${session.pwd}" required="">
            <input type="password" name="password" class="form-control is-valid" th:if="${session.pwd eq null}"
                   th:placeholder="#{login.password}" required="">
            <!--            <p style="color: red" th:text="${msg}"></p>-->
            <div class="alert alert-danger" th:text="${msg}" th:if="${not #strings.isEmpty(msg)}" role="alert">
                A simple danger alert—check it out!
            </div>
            <div class="checkbox mb-3">
                <label>
                    <input class="is-valid" th:if="${session.name ne null}" checked name="checkbox" type="checkbox"
                           th:text="#{login.remember}">
                    <input class="is-valid" th:if="${session.name eq null}" name="checkbox" type="checkbox"
                           th:text="#{login.remember}">
                </label>
                <hr/>
                <!--                <a th:href="@{/user/toregister}"  th:text="#{login.regist}">Create an account</a>-->
            </div>
            <button class="btn btn-lg btn-outline-success btn-block " type="submit" th:text="#{login.btn}">
                <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
                Sign in
            </button>
            <!--                <button class="btn btn-lg btn-outline-primary btn-block" id="register" type="button" th:onclick="'javascript:toregister()'"-->
            <!--                        th:text="#{login.regist}">Register-->
            <!--                </button>-->
            <a class="btn btn-lg btn-outline-success btn-block " href="/register.html" role="button"
               th:text="#{login.regist}">返回</a>


            <p class="mt-5 mb-3 text-muted">© 2020-2021</p>
            <a class="btn btn-sm" th:href="@{/index.html(l='zh_CN')}">中文</a>
            <a class="btn btn-sm" th:href="@{/index.html(l='en_US')}">English</a>
        </form>


    </body>

</html>